/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controladores.Form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author a70204
 */
public class CrearPlanEstudioForm extends org.apache.struts.action.ActionForm {
    
    private String ID;
    private String nombre;
    private String grado;
    private String cantCreditos;
    private String descripcion;
    private String ultimaModificacion;


    public String getID() {
        return ID;
    }
    public String getNombre() {
        return nombre;
    }
    public String getGrado() {
        return grado;
    }
    public String getCantCreditos() {
        return cantCreditos;
    }
    public String getDescripcion() {
        return descripcion;
    }
    public String getUltimaModificacion() {
        return ultimaModificacion;
    }
    public void setID(String string) {
        ID = string;
    }
    public void setNombre(String string) {
        nombre = string;
    }
    public void setGrado(String string) {
        grado = string;
    }
    public void setCantCreditos(String string) {
        cantCreditos = string;
    }
    public void setDescripcion(String string) {
        descripcion = string;
    }
    public void setUltimaModificacion(String string) {
        ultimaModificacion = string;
    }



    /**
     *
     */
    public CrearPlanEstudioForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if(nombre.length() <= 0) {
            errors.add("nombre", new ActionMessage("errors.nombre"));
        }
        if(ID.length() <= 0) {
            errors.add("ID", new ActionMessage("errors.cedula"));
        }
        mapping.getInputForward();//En caso de encontrar un error con esto recarga la pagina para mostrarlo, tambien se puede redirigir a otra pagina
        return errors;
    }
}
